Skip to content

Conversation

@oliverbaehler
Copy link
Collaborator

@oliverbaehler oliverbaehler commented Jan 22, 2026

By default a rule is applied to all namespaces within a Tenant. However you can select a subset of namespaces to apply the rule on, by using a namespaceSelector. This selector works the same way as a standard Kubernetes label selector:

---
apiVersion: capsule.clastix.io/v1beta2
kind: Tenant
metadata:
  name: solar
spec:
  ...
  rules:
    # Matches all Namespaces and enforces the rule for all of them
    - enforce:
        registries:
        -  url: "harbor/v2/customer-registry/.*"
           policy: [ "IfNotPresent" ]

    # Select a subset of namespaces (enviornment=prod) to allow further registries
    - namespaceSelector:
        matchExpressions:
          - key: env
            operator: In
            values: ["prod"]
      enforce:    
        registries:
         -  url: "harbor/v2/prod-registry/.*"
            policy: [ "IfNotPresent" ]

Note that rules are combined together. In the above example, all namespaces within the solar tenant will be enforced to use images from harbor/v2/customer-registry/, while namespaces labeled with env=prod will also be allowed to pull images from harbor/v2/prod-registry/.

Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Copy link
Collaborator

@Svarrogh1337 Svarrogh1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
@oliverbaehler oliverbaehler merged commit a6b830b into projectcapsule:main Jan 27, 2026
15 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants